#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int x = 0;
    int i = 0;
    int s = 0;
    int w = 0;
    int count = 0;
    for (x = 3; x < 1000; x += 2)
    {
        for (i = 2; i < x; i++)
        {
            if (x % i == 0)
            {
                break;
            }
        }
        if (x == i)
        {
            while (x)
            {
                s = x % 10;
                w = s + w;
                x = x / 10;
            }
            if (w == 23)
            {
                count = count + 1;
            }
        }
    }
    printf("%d", count);
    return 0;
}